package net.yambal.android.google_calender;
import java.util.List;
import net.yambal.android.secretary_alarm.R;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.Toast;

public class ActivityCalenderSelecter extends Activity implements ListenerArrayAdapterGoogleCalender{
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        setContentView(R.layout.layout_calender_selector);
        List<GoogleCalender> calenders = GoogleCalenderUtil.getCalenderList(this, true, false);
        ListView list_view_calenders = (ListView)findViewById(R.id.calenderSelectorListView);
        ArrayAdapterGoogleCalenders array_adapter = new ArrayAdapterGoogleCalenders(this, R.layout.layout_calender_item, calenders, this);
        list_view_calenders.setAdapter(array_adapter);
        
        /*
        List<GoogleCalenderEvent> events = GoogleCalenderUtil.getTommorowEventOfSelectedCalender(this);
        while(events.size() > 0){
        	GoogleCalenderEvent event = events.remove(0);
        	Toast.makeText(this, event.title, Toast.LENGTH_LONG).show();
        }
        */
        String text = GoogleCalenderUtil.getEventText(this, System.currentTimeMillis(), System.currentTimeMillis());
        Toast.makeText(this, text, Toast.LENGTH_LONG).show();
	}

	@Override
	public void onMySelectedChange(List<String> mySelectedIds) {
		GoogleCalenderUtil.setMySelectedIDs(this, mySelectedIds);
	}
}
